package com.example.yiwei.crm.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;


/**
 * Created by DHN on 2017/5/5.
 */

public class ZhengZhe {
    public static boolean phone(String string){
        String  regEx = "^1\\d{10}$|^(0|[2-9])\\d{1,11}$";
        Pattern pattern = Pattern.compile(regEx);
        Matcher matcher = pattern.matcher(string);
       if (matcher.matches()){

           return true;

       }
        return false;
    }
    public static boolean idCard(String string){
        String  regEx = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$";
        Pattern pattern = Pattern.compile(regEx);
        Matcher matcher = pattern.matcher(string);
        if (matcher.matches()){

            return true;

        }
        return false;
    }
}
